package com.liu.spike.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import com.liu.spike.entity.Product;

import java.util.List;

/**
 * (Product)表数据库访问层
 *
 * @author makejava
 * @since 2022-05-01 23:32:21
 */
@Mapper
@Repository
public interface ProductMapper extends BaseMapper<Product> {

    @Select("select * from product")
    List<Product> getAll();

    @Update("update product set stock = stock-1 where id = #{id}")
    void descStock(@Param("id") Integer id);

}